// #ifndef VUE3
import Vue from 'vue'
import App from './App'

// #ifdef APP-PLUS
import wfc from "./wfc/client/wfc"
import Config from "./config"
// #endif

Vue.config.productionTip = false
App.mpType = 'app'

const app = new Vue({
	...App
})
// #ifdef APP-PLUS
wfc.init();
// #endif

app.$mount()
// #endif
// #ifdef VUE3
import * as Pinia from 'pinia'
// import piniaPluginPersist from 'pinia-plugin-persist' //引入pinia数据持久化插件
import {
	createUnistorage
} from 'pinia-plugin-unistorage'
import api from '@/common/api.js'
import {
	createSSRApp
} from 'vue'
import {
	req
} from '@/common/vmeitime-http/'
import uviewPlus from '@/uni_modules/uview-plus'
import router from './router'
import App from './App.vue'

// #ifdef APP-PLUS
import wfc from "./wfc/client/wfc"
import wfcUIKit from "./wfc/uikit/wfcUIKit";
import Config from "./config"
import store from "@/store"
// #endif


export function createApp() {
	const app = createSSRApp(App)
	app.config.globalProperties.$api = api
	app.config.globalProperties.$req = req
	// app.config.globalProperties.$uploadUrl = 'http://192.168.1.22:8080'
	 app.config.globalProperties.$uploadUrl = ' https://meiye.xiaomansoft.cn:443'
	//app.config.globalProperties.$uploadUrl = 'https://website.wulinru.com'
	app.config.globalProperties.$shareUrl = 'https://website.wulinru.com/xxx/#/'

	const pinia = Pinia.createPinia()
	pinia.use(createUnistorage())
	app.use(pinia)
	// app.use(pinia.use(piniaPluginPersist)) //安装插件
	app.use(uviewPlus)
	app.use(router)

	// #ifdef APP-PLUS
	wfc.init();
	if (wfcUIKit.isUIKitEnable()) {
		Config.ICE_SERVERS.forEach(iceServer => {
			wfcUIKit.addICEServer(iceServer.uri, iceServer.userName, iceServer.password);
		})
	}
	store.init();
	// #endif

	return {
		app,
		Pinia
	}
}
// #endif